{extend name="default/template/base_index" /}


{block name="area_header"}

	<link rel="stylesheet" type="text/css" media="all" href="__CDN__/jquery-datetimepicker/jquery.datetimepicker.css">
	<script type="text/javascript" src="__CDN__/jquery-datetimepicker/jquery.datetimepicker.js"></script>
{/block}

{block name="area_body"}
	{include file="default/Widget/topbar" /}
	<div class="admin-main container-fluid">
		{include file="default/Widget/left" /}
		<div class="admin-main-content">
			{include file="default/Widget/breadcrumb" /}
				<!-- 过滤\查询按钮 -->
				<!--<div class="filter-controls">
					<form action="{:url('Vote/index')}" method="post" class="form-inline">
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">
									时间
									<i class="fa fa-calendar"></i>
								</div>
								<input type="text" name="startdatetime" id="startdatetime" class="form-control input-short" value="{:date('Y-m-d',$startdatetime)}" />
								<div class="input-group-addon">
									<i class="fa fa-long-arrow-right"></i>
								</div>
								<input type="text" name="enddatetime" id="enddatetime" class="form-control input-short" value="{:date('Y-m-d',$enddatetime)}" />
							</div>
						</div>
						<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-search"></i>{:L('BTN_SEARCH')}</button>
					</form>
				</div>-->
				<!-- 操作按钮 -->
				<div class="btn-controls">
					<a class="btn btn-primary btn-sm" href="{:url('Vote/add')}"><i class="fa fa-plus"></i>{:L('BTN_ADD')}</a>
					<!--<a target-form="selectitem" class="btn btn-danger btn-sm ajax-post confirm" href="{:url('Vote/bulkDelete')}"><i class="fa fa-trash"></i>{:L('BTN_DELETE')}</a>-->
					
				</div>

				<table class="table table-striped table table-hover  table-condensed">
					<thead>
						<tr>
							<th>
								<input type="checkbox" class="selectall" onclick="myUtils.selectall(this,'.selectitem');" />序号
							</th>
							<th>
								投票名称
							</th>
							<th>
								分组
							</th>
							<th>
								状态
							</th>
							<th>
								操作
							</th>
						</tr>
					</thead>
					<tbody>
						{empty name="list"}
							<tr>
								<td colspan="7" class="text-center">{:L('NO_DATA')}</td>
							</tr>
							{else/}
							{volist name="list" id="vo"}
								<tr>
									<td>
										<input type="checkbox" value="{$vo.id}" name="ids[]" class="selectitem" />{$vo.sort}</td>
									
									<td>
										{$vo.vote_name}
									</td>
									<td>{$vo.group}
									</td>
									<td>
										{:(time() - $vo['endtime'] < 0 ? "进行中":"已结束")}
									</td>
									<td>
										<a href="{:url('Weixin/Vote/index',array('group'=>$vo['group']))}" target="_blank" class="btn btn-sm btn-primary">查看地址</a>
										
										<a href="{:url('VoteOption/index',array('vote_id'=>$vo['id']))}" class="btn btn-sm btn-primary"><i class="fa fa-plus"></i>添加选项</a>
										<a href="{:url('Vote/edit',array('id'=>$vo['id']))}" class="btn btn-sm btn-default"><i class="fa fa-edit"></i>编辑</a>
										<a href="{:url('Vote/delete',array('id'=>$vo['id']))}" class="ajax-get confirm btn btn-sm btn-danger"><i class="fa fa-trash"></i>删除</a>
									</td>
								</tr>

							{/volist}
						{/empty}
					</tbody>
				</table>
				<div>{$show}</div>
			</div>

			<script type="text/javascript">
				$(function() {
						$('#startdatetime').datetimepicker({
							lang: 'ch',
							format:'Y-m-d',
							timepicker:false,
						});
						$('#enddatetime').datetimepicker({
							lang: 'ch',
							format:'Y-m-d',
							timepicker:false,
						});
				});
			</script>
		</div>
		<!-- END admin-main-content -->
	</div>
		<!-- END admin-main-->
{/block}

{block name="area_footer"}

{/block}